﻿using GalaSoft.MvvmLight;
using OSSUtility;
using OSSUtility.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ozone.Models.JsonModel
{
    #region 1 下发配置
    //请求
    public class AS_SendConfigList_Req
    {
        public ReqInfoModel ReqInfo { set; get; }
        public SendConfigList_Data Data { set; get; }

        public AS_SendConfigList_Req()
        {
            ReqInfo = new ReqInfoModel();
            Data = new SendConfigList_Data();

            ReqInfo.CmdType = "SendConfigList";
        }
    }

    public class SendConfigList_Data
    {
        public string FName { set; get; } = "";
        public int ListCount { set; get; }
        public List<AS_ConfigListItem> ListItems = new List<AS_ConfigListItem>();
    }

    public class AS_ConfigListItem : ObservableObject
    {
        private int FNO_;
        private string BottleNo_;
        private int IntervalTime_;
        private string SamplingTime_;
        private double DilutionAmount_;
        private int CleaningTimes_;
        private int LRDirection_;

        public int FNO
        {
            get { return FNO_; }
            set { FNO_ = value; RaisePropertyChanged(String.Empty); }
        }
        public string BottleNo
        {
            get { return BottleNo_; }
            set { BottleNo_ = value; RaisePropertyChanged(String.Empty); }
        }
        public int IntervalTime
        {
            get { return IntervalTime_; }
            set { IntervalTime_ = value; RaisePropertyChanged(String.Empty); }
        }
        public string SamplingTime
        {
            get { return SamplingTime_; }
            set { SamplingTime_ = value; RaisePropertyChanged(String.Empty); }
        }
        public double DilutionAmount
        {
            get { return DilutionAmount_; }
            set { DilutionAmount_ = value; RaisePropertyChanged(String.Empty); }
        }
        public int CleaningTimes
        {
            get { return CleaningTimes_; }
            set { CleaningTimes_ = value; RaisePropertyChanged(String.Empty); }
        }
        public int LRDirection
        {
            get { return LRDirection_; }
            set { LRDirection_ = value; RaisePropertyChanged(String.Empty); }
        }
    }


    #endregion

    #region 2 请求配置
    //请求
    public class AS_GetConfigList_Req
    {
        public ReqInfoModel ReqInfo { set; get; }
        public SendConfigList_Data Data { set; get; }

        public AS_GetConfigList_Req()
        {
            ReqInfo = new ReqInfoModel();
            Data = new SendConfigList_Data();
            ReqInfo.CmdType = "GetConfigList";
        }
    }
    //回复
    public class AS_GetConfigList_Respond
    {
        public ResultContent Result { set; get; }
        public SendConfigList_Data Data { set; get; }

        public AS_GetConfigList_Respond()
        {
            Result = new ResultContent();
            Data = new SendConfigList_Data();
        }
    }
    #endregion

    #region 3 开关控制

    //请求
    public class AS_SetSwitch_Req
    {
        public ReqInfoModel ReqInfo { set; get; }
        public SetSwitch_Data Data { set; get; }

        public AS_SetSwitch_Req()
        {
            ReqInfo = new ReqInfoModel();
            Data = new SetSwitch_Data();

            ReqInfo.CmdType = "SetSwitch";
        }
    }
    public class SetSwitch_Data
    {
        //-1:忽略 0:停止 1：启动 2：暂停 3:清洗 4:排空	5：取消暂停
        public int SwitchType { set; get; } = -1;
        //托盘状态  -1:忽略 0:进仓 1：出仓
        public int PalletStatus { set; get; } = -1;
        public double CleaningExtractionVolume { set; get; } = 0;
        public double InspiratoryCapacity { set; get; } = 0;
        public double DilutionExtractionVolume { set; get; } = 0;
        public int SampleLoadingTime { set; get; } = 0;

    }
    #endregion

    #region 4 请求孔位状态
    //请求
    public class AS_GetHoleStatusList_Req
    {
        public ReqInfoModel ReqInfo { set; get; }

        public AS_GetHoleStatusList_Req()
        {
            ReqInfo = new ReqInfoModel();
            ReqInfo.CmdType = "GetHoleStatusList";
        }
    }

    //回复
    public class AS_GetHoleStatusList_Respond
    {
        public ResultContent Result { set; get; }
        public HoleStatusList_Data Data { set; get; }

        public AS_GetHoleStatusList_Respond()
        {
            Result = new ResultContent();
            Data = new HoleStatusList_Data();
        }
    }

    public class HoleStatusListItem
    {
        public string BottleNo { set; get; }
        //0:无瓶 1:进样 2:有瓶 3:稀释
        public int Status { set; get; }

        //0:未完成 1：已完成
        public int BottleIsOK { set; get; } = 0;
    }

    public class HoleStatusList_Data
    {
        public int ListCount { set; get; }
        public List<HoleStatusListItem> ListItems = new List<HoleStatusListItem>();
    }
    #endregion

    #region 5 获取运行状态

    //请求
    public class AS_GetRunStatus_Req
    {
        public ReqInfoModel ReqInfo { set; get; }

        public AS_GetRunStatus_Req()
        {
            ReqInfo = new ReqInfoModel();
            ReqInfo.CmdType = "GetRunStatus";
        }
    }
    //回复
    public class AS_GetRunStatus_Respond
    {
        public ResultContent Result { set; get; }
        public SetSwitch_Data Data { set; get; }

        public AS_GetRunStatus_Respond()
        {
            Result = new ResultContent();
            Data = new SetSwitch_Data();
        }
    }
    #endregion

    #region 6 获取文件列表

    //请求
    public class AS_GetFileNameList_Req
    {
        public ReqInfoModel ReqInfo { set; get; }

        public AS_GetFileNameList_Req()
        {
            ReqInfo = new ReqInfoModel();
            ReqInfo.CmdType = "GetFileNameList";
        }
    }
    //回复
    public class AS_GetFileNameList_Respond
    {
        public ResultContent Result { set; get; }
        public FileList_Data Data { set; get; }

        public AS_GetFileNameList_Respond()
        {
            Result = new ResultContent();
            Data = new FileList_Data();
        }
    }

    public class FileList_Data
    {
        public string FileList { set; get; }
    }
    #endregion


    public class MyPoint
    {
        public double x { get; set; }
        public double y { get; set; }
        public double z { get; set; }

        public MyPoint()
        {
            x = 0;
            y = 0;
            z = 0;
        }

        public MyPoint(string cc)
        {
            string[] sa = cc.Split(',');
            if (sa.Length == 3)
            {
                x = Utility.str2Double(sa[0]);
                y = Utility.str2Double(sa[1]);
                z = Utility.str2Double(sa[2]);
            }
        }
    }
}
